import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni()],
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, 'src')
      },
      {
        find: '@/utils',
        replacement: resolve(__dirname, 'src/utils')
      },
      {
        find: '@/store',
        replacement: resolve(__dirname, 'src/store')
      },
      {
        find: '@/types',
        replacement: resolve(__dirname, 'src/types')
      },
      {
        find: '@/styles',
        replacement: resolve(__dirname, 'src/styles')
      }
    ]
  },
  optimizeDeps: {
    include: ['vue-demi'],
    exclude: ['vue-router']
  },
  define: {
    'process.env': {},
    __VUE_OPTIONS_API__: true,
    __VUE_PROD_DEVTOOLS__: false
  },
  build: {
    target: 'es2015',
    minify: 'terser',
    cssCodeSplit: true,
    chunkSizeWarningLimit: 2000,
    outDir: 'dist',
    assetsDir: 'assets'
  },
  server: {
    host: true,
    port: 8080,
    proxy: {},
    open: true,
    fs: {
      strict: false,
      allow: ['..']
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/styles/theme.scss";'
      }
    }
  }
}); 